<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>用户列表</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${ctx!}/assets/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx!}/assets/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="${ctx!}/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">

    <link href="${ctx!}/assets/css/animate.css" rel="stylesheet">
    <link href="${ctx!}/assets/css/style.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="${ctx!}/assets/css/reset.css">
    <link rel="stylesheet" href="${ctx!}/assets/css/check.css">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox " style="padding-bottom:100px">
                    <div class="ibox-title">
                        <h5>核销页面</h5>
                    </div>
                    <div class="wrapper">
                        <header>
                          <div class="logo m-a">
                            <img src="${ctx!}/assets/images/check/logo.svg" alt="">
                          </div>
                        </header>
                        <section>
                          <div class="sec_titel fw6 t-a">
                            <p>2019名爵上海车展核销</p>
                          </div>
                          <div class="input_wrap m-a">
                            <span class="ipt_wr ">
                              <input type="text" id="code" class="num fw6">
                            </span>
                            <span class="btn_wr">
                              <input type="button" id="hexiao" class="btn fw6" value="核销">
                            </span>
                          </div>
                          <div class="state_wrap" id="hexiaoMessage" style="display:none">
                            <div class="state_result">
                              <img src="${ctx!}/assets/images/check/suc.svg" alt="">
                              <p class="state_title fw6"></p>
                            </div>
                            <p class="state_message fw3">
                            </p>
                          </div>
                        </section>

                      </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="${ctx!}/assets/js/jquery.min.js?v=2.1.4"></script>

    <!-- Page-Level Scripts -->
    <script>
        $(document).ready(function () {
            $("#hexiao").click(function(){
                if($("#code").val().length<6){
                    return;
                }
                $("#hexiaoMessage").hide();
                $.ajax({
                    url: "${ctx!}/mg/hexiaoCode",
                    data:{"code":$("#code").val()},
                    type:"GET",
                    dataType:"jsonp",
                    success:function(data){
                        if(data.status=='ok'){
                            $("#hexiaoMessage").show();
                            $("#hexiaoMessage").find("img").attr("src","${ctx!}/assets/images/check/suc.svg");
                            $("#hexiaoMessage").find(".state_title").text('').text("核销成功！");
                            var html="姓名："+data.userName+"<br>"+"联系方式："+data.telephone;
                            $("#hexiaoMessage").find(".state_message").html('').append(html);
                        }else{
                            $("#hexiaoMessage").show();
                            $("#hexiaoMessage").find("img").attr("src","${ctx!}/assets/images/check/fail.svg");
                            $("#hexiaoMessage").find(".state_title").text('').text("核销失败！");
                            $("#hexiaoMessage").find(".state_message").text('').text(data.message);
                        }
                    }
                });
            });

            $("#code").change(function () {

                if($("#code").val().length<6){
                    return;
                }
                $("#hexiaoMessage").hide();
                $.ajax({
                    url: "${ctx!}/mg/hexiaoCode",
                    data:{"code":$("#code").val()},
                    type:"GET",
                    dataType:"jsonp",
                    success:function(data){
                        if(data.status=='ok'){
                            $("#hexiaoMessage").show();
                            $("#hexiaoMessage").find("img").attr("src","${ctx!}/assets/images/check/suc.svg");
                            $("#hexiaoMessage").find(".state_title").text('').text("核销成功！");
                            var html="姓名："+data.userName+"<br>"+"联系方式："+data.telephone;
                            $("#hexiaoMessage").find(".state_message").html('').append(html);
                        }else{
                            $("#hexiaoMessage").show();
                            $("#hexiaoMessage").find("img").attr("src","${ctx!}/assets/images/check/fail.svg");
                            $("#hexiaoMessage").find(".state_title").text('').text("核销失败！");
                            $("#hexiaoMessage").find(".state_message").text('').text(data.message);
                        }
                    }
                });
            });
        });
    </script>
</body>

</html>
